//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Spreadsheet
{
    public class ChartsheetProperties: IOfficeXmlSerializable
    {
        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (ReadContext c = context.Read("sheetPr"))
            {
                Published = c.GetOptionalBoolean("published", true);
                CodeName = c.GetOptionalString("codeName");
                if (c.ReaderLocalName == "tabColor")
                    TabColor = SpreadsheetColor.ReadColor("tabColor", c);
            }
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (WriteContext c = context.Write("sheetPr"))
            {
                c.SetOptionalBoolean("published", Published, true);
                c.SetOptionalString("codeName", CodeName);
                if (TabColor != null)
                    TabColor.WriteXmlAs("tabColor", c);
            }
        }

        #endregion

        private SpreadsheetColor _tabColor;

        public SpreadsheetColor TabColor
        {
            get { return _tabColor; }
            set { _tabColor = value; }
        }
        private bool _published = true;

        public bool Published
        {
            get { return _published; }
            set { _published = value; }
        }
        private string _codeName;

        public string CodeName
        {
            get { return _codeName; }
            set { _codeName = value; }
        }
	
	
    }
}
